package com.zuoqi.easywork.userManage.controller;

import com.zuoqi.common.utils.IMap;
import com.zuoqi.common.utils.ReturnMapUtils;
import com.zuoqi.easywork.userManage.service.DepartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@Controller
public class departController {
    @Autowired
    private DepartService departService;

    @RequestMapping(value = "/departController/ajax/search/departList",method = {RequestMethod.POST})
    @ResponseBody
    public Map selectAllDepart(){
        List<Map> list = departService.selectAllDepart();
        return ReturnMapUtils.businessResult("0000","",list);
    }

    @RequestMapping(value = "/departController/ajax/search/searchDepartById",method = {RequestMethod.POST})
    @ResponseBody
    public Map searchDepartById(HttpServletRequest request){
        IMap param = new IMap(request);
        String departId = param.getString("departId","");
        Map result = departService.searchDepartById(departId);
        return ReturnMapUtils.businessResult("0000","",result);
    }
}
